#include<bits/stdc++.h>
using namespace std;
int n;
int a[100010];
vector<int>v;
int cnt;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        int m;
        cin>>m;
        a[m]++;
        if(a[m]==1)v.push_back(m);
    }
    sort(v.begin(),v.end());
    while(v.size()!=1&&v.size()!=0){
        for(int i=0;i<v.size()-1;i++){
            a[v[i]]--;
            if(a[v[i]]==0){
                v.erase(v.begin()+i);
                i--;
            }
        }
        cnt++;
        a[v[v.size()-1]]--;
        if(a[v[v.size()-1]]==0){
            v.erase(v.end()-1);
        }
    }
    if(v.size()==0)cout<<cnt;
    else cout<<cnt+a[v[0]];
    return 0;
}
